import {getlink} from "@/api/getapi.js" 
export let tidem={
    state: {
      navarr:[],
      promotionarr:[],
      cutearr:[],
      morearr:[],
      detailarr:{},
      dataa:{},
      datab:{},
      datac:{},
      datad:{},
      datae:{},
      dataf:{},
      datag:{},
      datah:{},
      datai:{},
    },
    mutations: {
      datanav(state,payload){
        state.navarr = payload;
      },
      datapromotion(state,payload){
        state.promotionarr = payload;
      },
      datacute(state,payload){
        state.cutearr = payload;
      },
      datamore(state,payload){
        state.morearr = payload;
      },
      datadetail(state,payload){
        state.detailarr = payload;
      },
      // 咖啡周边abcdefghe
      dataa(state,payload){
        state.dataa = payload
      },
      datab(state,payload){
        state.datab = payload
      },
      datac(state,payload){
        state.datac = payload
      },
      datad(state,payload){
        state.datad = payload
      },
      datae(state,payload){
        state.datae = payload
      },
      dataf(state,payload){
        state.dataf = payload
      },
      datag(state,payload){
        state.datag = payload
      },
      datah(state,payload){
        state.datah = payload
      },
      datai(state,payload){
        state.datai = payload
      },
    },
    actions: {
      // 潮品abcdefghi
      goodsmenua(comtext,payload){
        console.log(payload.url)
        getlink(payload.url).then((ok)=>{
          console.log("请求成功",ok.data)
          comtext.commit("dataa",ok.data)
        }).catch((err)=>{
          console.log(err,"失败")
        })
      },
      goodsmenub(comtext,payload){
        console.log(payload.url)
        getlink(payload.url).then((ok)=>{
          console.log("请求成功",ok.data)
          comtext.commit("datab",ok.data)
        }).catch((err)=>{
          console.log(err,"失败")
        })
      },
      goodsmenuc(comtext,payload){
        console.log(payload.url)
        getlink(payload.url).then((ok)=>{
          console.log("请求成功",ok.data)
          comtext.commit("datac",ok.data)
        }).catch((err)=>{
          console.log(err,"失败")
        })
      },
      goodsmenud(comtext,payload){
        console.log(payload.url)
        getlink(payload.url).then((ok)=>{
          console.log("请求成功",ok.data)
          comtext.commit("datad",ok.data)
        }).catch((err)=>{
          console.log(err,"失败")
        })
      },
      goodsmenue(comtext,payload){
        console.log(payload.url)
        getlink(payload.url).then((ok)=>{
          console.log("请求成功",ok.data)
          comtext.commit("datae",ok.data)
        }).catch((err)=>{
          console.log(err,"失败")
        })
      },
      goodsmenuf(comtext,payload){
        console.log(payload.url)
        getlink(payload.url).then((ok)=>{
          console.log("请求成功",ok.data)
          comtext.commit("dataf",ok.data)
        }).catch((err)=>{
          console.log(err,"失败")
        })
      },
      goodsmenug(comtext,payload){
        console.log(payload.url)
        getlink(payload.url).then((ok)=>{
          console.log("请求成功",ok.data)
          comtext.commit("datag",ok.data)
        }).catch((err)=>{
          console.log(err,"失败")
        })
      },
      goodsmenuh(comtext,payload){
        console.log(payload.url)
        getlink(payload.url).then((ok)=>{
          console.log("请求成功",ok.data)
          comtext.commit("datah",ok.data)
        }).catch((err)=>{
          console.log(err,"失败")
        })
      },
      goodsmenui(comtext,payload){
        console.log(payload.url)
        getlink(payload.url).then((ok)=>{
          console.log("请求成功",ok.data)
          comtext.commit("datai",ok.data)
        }).catch((err)=>{
          console.log(err,"失败")
        })
      },
      // 潮品导航
      actionsnav(context){
        getlink("/fashionNav").then((ok)=>{
          context.commit("datanav",ok.data)
        })
      },
      // 潮品促销
      actionspromotion(context){
        getlink("/fashionPromotion").then((ok)=>{
          context.commit("datapromotion",ok.data)
      })
      },
      // 潮品萌咖
      actionscute(context){
        getlink("/fashionCute").then((ok)=>{
          context.commit("datacute",ok.data)
      })
      },
      // 潮品更多加载
      // actionsmore(context){
      //   getlink("/fashionMore").then((ok)=>{
      //     context.commit("datamore",ok.data)
      // })
      // },
      // 商品详情
      actionsdetail(context,payload){
        getlink(payload.url).then((ok)=>{
          console.log(ok.data)
          context.commit("datadetail",ok.data)
        })
      },
      actionsmore(context,payload){
        getlink(payload.url).then((ok)=>{
          context.commit("datamore",ok.data)
          console.log(ok.data)
      }).catch((err)=>{
        console.log(err) 
      })
      }, 
    },
    //   actionsmore(){
    //     getlink("http://81.68.226.70:8050/goods/家居日常/").then((ok)=>{
    //       // context.commit("datamore",ok.data)
    //       console.log(ok)
    //   }).catch((err)=>{
    //     console.log(err) 
    //   })
    //   }, 
    // },
    
    
      }
    

